<%@page import="cn.sendto.dbhelper.DBHelper"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="getSession.jsp" %>
<%
	request.setCharacterEncoding("utf-8");

	//get form data
	String name = request.getParameter("studentname");
	String gender = request.getParameter("gender");
	String age = request.getParameter("age");
	String no = request.getParameter("studentno");
	String address= request.getParameter("address");
	String tel = request.getParameter("tel");
	String cid = request.getParameter("classid");
	String pwd = request.getParameter("password");
	
	DBHelper helper = new DBHelper();
	
	String sql ="insert into studentinfo (studentid,studentname,gender,age,studentno,address,telphone,classid,password)"+
	"values (uuid(),?,?,?,?,?     ,?,?,?)";
	
	int i = helper.executeInsert(sql, name,gender,age,no,address,tel,cid,pwd);
	
	helper.close();
	if(i>0){
		%>
			<script type="text/javascript">
			alert("添加成功");
			window.location.href="student_list.jsp";
			</script>
		<%
	}else{
		%>
			<script type="text/javascript">
			alert("添加失败");
			window.location.href="student_list.jsp";
			</script>
		<%
	}
	

%>